kill_timer(&v->arch.hlt_timer);
}
+struct domain *alloc_domain_struct(void)
+{
+ return xmalloc(struct domain);
+}
+
+void free_domain_struct(struct domain *d)
+{
+ xfree(d);
+}
+
struct vcpu *alloc_vcpu_struct(void)
{
struct page_info *page;
}
}
+struct domain *alloc_domain_struct(void)
+{
+ struct domain *d;
+ /*
+ * We pack the MFN of the domain structure into a 32-bit field within
+ * the page_info structure. Hence the MEMF_bits() restriction.
+ */
+ d = alloc_xenheap_pages(
+ get_order_from_bytes(sizeof(*d)), MEMF_bits(32 + PAGE_SHIFT));
+ if ( d != NULL )
+ memset(d, 0, sizeof(*d));
+ return d;
+}
+
+void free_domain_struct(struct domain *d)
+{
+ free_xenheap_pages(d, get_order_from_bytes(sizeof(*d)));
+}
+
struct vcpu *alloc_vcpu_struct(void)
{
struct vcpu *v;
return current->domain->domain_id;
}
-static struct domain *alloc_domain_struct(void)
-{
- return xmalloc(struct domain);
-}
-
-static void free_domain_struct(struct domain *d)
-{
- xfree(d);
-}
-
static void __domain_finalise_shutdown(struct domain *d)
{
struct vcpu *v;
/* Page is in use: ((count_info & PGC_count_mask) != 0). */
struct {
/* Owner of this page (NULL if page is anonymous). */
- unsigned long _domain; /* pickled format */
+ u32 _domain; /* pickled format */
/* Type reference count and various PGT_xxx flags and fields. */
unsigned long type_info;
} inuse;
/* OOS fixup entries */
#define SHADOW_OOS_FIXUPS 2
-#define page_get_owner(_p) ((struct domain *)(_p)->u.inuse._domain)
-#define page_set_owner(_p,_d) ((_p)->u.inuse._domain = (unsigned long)(_d))
+#define page_get_owner(_p) \
+ ((struct domain *)((_p)->u.inuse._domain ? \
+ mfn_to_virt((_p)->u.inuse._domain) : NULL))
+#define page_set_owner(_p,_d) \
+ ((_p)->u.inuse._domain = (_d) ? virt_to_mfn(_d) : 0)
#define maddr_get_owner(ma) (page_get_owner(maddr_to_page((ma))))
#define vaddr_get_owner(va) (page_get_owner(virt_to_page((va))))
* Arch-specifics.
*/
+/* Allocate/free a domain structure. */
+struct domain *alloc_domain_struct(void);
+void free_domain_struct(struct domain *d);
+
/* Allocate/free a VCPU structure. */
struct vcpu *alloc_vcpu_struct(void);
void free_vcpu_struct(struct vcpu *v);